package com.xzy.controller.b;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 说明：域对象共享数据
 *
 * @author xzy
 * @date 2021/11/14 22:20
 */
@Slf4j
@RestController("controllerB")
@RequestMapping("/test_b")
public class TestController {

    /**
     * 通过ServletAPI向request域对象共享数据
     */
    @GetMapping("/a1")
    public void testA1(HttpServletRequest httpServletRequest) {
        httpServletRequest.setAttribute("username", "xiaozy");
    }
}
